package com.persondemo.videoappliction.ui.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.persondemo.videoappliction.ui.duanzi.DuanziDetilsFragment;
import com.persondemo.videoappliction.ui.duanzi.ZiXunFragment;

import java.util.List;

import fm.jiecao.jcvideoplayer_lib.JCVideoPlayer;

/**
 * Created by Administrator on 2018/4/19.
 */

public class FragmentVpAdapter extends FragmentPagerAdapter {
    private List<String> titleList;
    private List<Fragment> fragmentList;
    public FragmentVpAdapter(FragmentManager fm, List<String> titleList) {
        super(fm);
        this.titleList = titleList;
    }

    @Override
    public Fragment getItem(int position) {
        if (position==5){
            return ZiXunFragment.newInstance();
        }else {
            return DuanziDetilsFragment.newInstance(titleList.get(position).toString());
        }

    }

    @Override
    public int getCount() {
        return titleList.size();
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return titleList.get(position);
    }

}
